<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
    <meta name="generator" content="HTML Tidy for Linux/x86 (vers 1st November 2003), see www.w3.org"/>
    <title>JavaScript: Basics</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta name="copyright" content="Copyright &#169; 2005-2010 W3C (MIT, ERCIM, Keio)"/>
    <meta name="duration" content="5"/>
    <meta name="font-size-adjustment" content="-2"/>

    <link rel="stylesheet" href="styles/slidy.css" type="text/css"/>
    <link rel="stylesheet" href="styles/w3c-blue.css" type="text/css"/>
	<script type="text/javascript" src="scripts/slidy.js" charset="utf-8">//</script>

    <link type="text/css" rel="stylesheet" href="styles/shCoreDefault.css"/>
    <script type="text/javascript" src="scripts/shCore.js"></script>
    <script type="text/javascript" src="scripts/shBrushJScript.js"></script>

    <link type="text/css" rel="stylesheet" href="styles/presentation.css"/>
    <script type="text/javascript" src="scripts/presentation.js"></script>
</head>


<body style="background: white; font-family: Helvetica">
<div class="background">
    <img alt="" id="head-icon" src="graphics/icon-blue.png"/>
</div>

<div class="background slanty">
</div>

<div class="slide cover title">
    <img class="hidden" src="graphics/bullet.png" alt=""/>
    <img class="hidden" src="graphics/fold.gif" alt=""/>
    <img class="hidden" src="graphics/unfold.gif" alt=""/>
    <img class="hidden" src="graphics/fold-dim.gif" alt=""/>
    <img class="hidden" src="graphics/nofold-dim.gif" alt=""/>
    <img class="hidden" src="graphics/unfold-dim.gif" alt=""/>
    <img class="hidden" src="graphics/bullet-fold.gif" alt=""/>
    <img class="hidden" src="graphics/bullet-unfold.gif" alt=""/>
    <img class="hidden" src="graphics/bullet-fold-dim.gif" alt=""/>
    <img class="hidden" src="graphics/bullet-nofold-dim.gif" alt=""/>
    <img class="hidden" src="graphics/bullet-unfold-dim.gif" alt=""/>
    
    <h1>JavaScript: Test</h1>

    <p>Alex Kolonitsky</p>
</div>

<div class="slide">
    <h1>01</h1>

    <p>What does it return?</p>
    <ul>
        <li>100['toString']['length']</li>
        <li>1 && "foo" || 0</li>
        <li>
            <pre class="brush: js">
                x = 1; (function(){return x; var x = 2;}())
            </pre>
        </li>
    </ul>

</div>

<div class="slide">
    <h1>02</h1>

    <pre class="brush: js">
        var o = {
            x: 8,
    
            valueOf: function(){
                return this.x + 2;
            },
            toString: function(){
                return this.x.toString();
            }
        },
        result = o < "9";
        console.log(o, result)
    </pre>
</div>

<div class="slide">
    <h1>05</h1>

    <pre class="brush: js">
        var x;

        for(x in {}) {
            alert(x);
        }
    </pre>
</div>

<div class="slide">
    <h1>06</h1>

    <p>Что выведет alert</p>
    <pre class="brush: js">
        var x = 5;
        var o = {
            x: 10,
            doIt: function doIt() {
                var x = 20,
                setTimeout(function () {
                    alert(this.x)
                }, 10);
            }
        };
        o.doIt();
    </pre>
</div>

<div class="slide">
    <h1>07</h1>

    <pre class="brush: js">
        function f() {return f;}
        new f() instanceof f
    </pre>

    <ul class="incremental">
        <li>true</li>
        <li>false</li>
        <li>Error</li>
    </ul>
</div>

<div class="slide">
    <h1>08</h1>

    <pre class="brush: js">
        function A () {}
        A.prototype = {
            x: 10
        }

        var a = new A();
        console.log(a.constructor === A);
    </pre>

    <ul class="incremental">
        <li>true</li>
        <li>false</li>
        <li>undefined</li>
        <li>Error</li>
    </ul>
</div>

<div class="slide">
    <h1>09</h1>

    <pre class="brush: js">
        function A() {}
        A.prototype.x = 10;
        var a = new A();
        var b = new A();
        b.x = 15

        console.log(a.x);
    </pre>
</div>


<div class="slide">
    <h1>10</h1>

    <pre class="brush: js">
        function A() {}
        A.prototype.x = 10;
        var a = new A();
        var b = new A();
        A.prototype.x = 15

        console.log(a.x);
    </pre>
</div>

<div class="slide">
    <h1>11</h1>

    <pre class="brush: js">
        function A() {}
        A.prototype.x = 10;
        var a = new A();
        var b = new A();
        A.prototype = {x:20}

        console.log(a.x);
    </pre>
</div>
</body>
</html>
